{% extends 'layout/base.html' %}
{% load static %}
{% block right_content %}
<div class="layui-container fly-marginTop">
  <div class="fly-panel" pad20 style="padding-top: 5px;">
    <div class="layui-form layui-form-pane">
      <div class="layui-tab layui-tab-brief" lay-filter="user">
        <ul class="layui-tab-title">
          <li class="layui-this">编辑内容
            <!-- 编辑帖子 -->
          </li>
        </ul>
        <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
          <div class="layui-tab-item layui-show">
            <form action="" method="post">
              {% csrf_token %}
              <div class="layui-row layui-col-space15 layui-form-item">
                <div class="layui-col-md5">
                  <label class="layui-form-label">所在专栏</label>
                  <div class="layui-input-block">
                    <select lay-verify="required" lay-filter="column">
                      <option selected='selected'>{{category_name}}</option>
                    </select>
                  </div>
                </div>
                <div class="layui-col-md7">
                  <label for="L_title" class="layui-form-label">标题</label>
                  <div class="layui-input-block">
                    <input type="text" id="L_title" name="title" maxlength="30" value="{{title}}" required
                      lay-verify="required" autocomplete="off" class="layui-input">
                  </div>
                </div>
              </div>
              <div class="layui-form-item layui-form-text">
                <div class="layui-input-block">
                  <textarea id="content" name="content" required lay-verify="required" placeholder="详细描述"
                    style="display: none;">{{content}}</textarea>
                </div>
              </div>

              {% if request.user.is_superuser %}
              <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label">内容类型</label>
                  <div class="layui-input-inline" style="width: 190px;">
                    <select name="article_type">
                      {% for k,v in article_type_list.items %}
                      {% if v == article_type %}
                      <option selected="selected" value="{{v}}">{{k}}</option>
                      {% else %}
                      <option  value="{{v}}">{{k}}</option>
                      {% endif %}
                      {% endfor %}
                    </select>
                  </div>
                </div>
              </div>
              {% endif %}


              <div class="layui-form-item">
                <input type="hidden" name="aid" value="{{id}}">
                <button class="layui-btn" lay-filter="edit" lay-submit>立即更新</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}

{% block script %}
<script src="{% static 'index/js/edit.js' %}"></script>
{% endblock%}